const Controller = require('egg').Controller;

class RoleController extends Controller {
  // 获取
  async index() {
    try {
      let roleList = await this.ctx.service.role.getRole();
      this.ctx.body = {
        code: 20000,
        message: '获取角色成功',
        data: roleList
      };
    } catch (error) {
      this.ctx.body = {
        code: 50000,
        message: '服务器错误'
      };
    }
  }
}

module.exports = RoleController;
